async function getProduction(a, b) {
    return new Promise(resolve => setTimeout(resolve, 1000, a * b))
}

/* 求n的阶乘 */
function getFactorial(n) {
    let ret = 1, b = 2;

    if (n === 1) {
        return Promise.resolve(1)
    }

    return getFactorial(n - 1).then(
        v => getProduction(n, v)
    )
}

getFactorial(5)
    .then(
        value => console.log("value=", value)
    )
